using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: daiduong19051986@gmail.com 
	/// <summary>
	
    public class csreportgroupsInfo
    {
		#region Local Variable
		public enum Field
		{
			DB,
			ReportGroup,
			Name,
			DAGid,
			Createdby,
			Insertpointoftime,
			Updatedby,
			Lastupdate
		}
		private String _DB;
		private String _ReportGroup;
		private String _Name;
		private String _DAGid;
		private String _Createdby;
		private DateTime _Insertpointoftime;
		private String _Updatedby;
		private DateTime _Lastupdate;
		
		public String DB{	get{ return _DB;} set{_DB = value;} }
		public String ReportGroup{	get{ return _ReportGroup;} set{_ReportGroup = value;} }
		public String Name{	get{ return _Name;} set{_Name = value;} }
		public String DAGid{	get{ return _DAGid;} set{_DAGid = value;} }
		public String Createdby{	get{ return _Createdby;} set{_Createdby = value;} }
		public DateTime Insertpointoftime{	get{ return _Insertpointoftime;} set{_Insertpointoftime = value;} }
		public String Updatedby{	get{ return _Updatedby;} set{_Updatedby = value;} }
		public DateTime Lastupdate{	get{ return _Lastupdate;} set{_Lastupdate = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public csreportgroupsInfo()
		{
			_DB = "";
			_ReportGroup = "";
			_Name = "";
			_DAGid = "";
			_Createdby = "";
			_Insertpointoftime = DateTime.Now;
			_Updatedby = "";
			_Lastupdate = DateTime.Now;
		}
		public csreportgroupsInfo(
		String DB,
		String ReportGroup,
		String Name,
		String DAGid,
		String Createdby,
		DateTime Insertpointoftime,
		String Updatedby,
		DateTime Lastupdate
		)
		{
			_DB = DB;
			_ReportGroup = ReportGroup;
			_Name = Name;
			_DAGid = DAGid;
			_Createdby = Createdby;
			_Insertpointoftime = Insertpointoftime;
			_Updatedby = Updatedby;
			_Lastupdate = Lastupdate;
		}
		public csreportgroupsInfo(DataRow dr)
		{
			if (dr != null)
			{
				_DB = dr[Field.DB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DB.ToString()]);
				_ReportGroup = dr[Field.ReportGroup.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ReportGroup.ToString()]);
				_Name = dr[Field.Name.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Name.ToString()]);
				_DAGid = dr[Field.DAGid.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DAGid.ToString()]);
				_Createdby = dr[Field.Createdby.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Createdby.ToString()]);
				_Insertpointoftime = dr[Field.Insertpointoftime.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.Insertpointoftime.ToString()]);
				_Updatedby = dr[Field.Updatedby.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Updatedby.ToString()]);
				_Lastupdate = dr[Field.Lastupdate.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.Lastupdate.ToString()]);
			}
		}
		public csreportgroupsInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_DB = dr[Field.DB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DB.ToString()]);
				_ReportGroup = dr[Field.ReportGroup.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ReportGroup.ToString()]);
				_Name = dr[Field.Name.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Name.ToString()]);
				_DAGid = dr[Field.DAGid.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DAGid.ToString()]);
				_Createdby = dr[Field.Createdby.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Createdby.ToString()]);
				_Insertpointoftime = dr[Field.Insertpointoftime.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.Insertpointoftime.ToString()]);
				_Updatedby = dr[Field.Updatedby.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Updatedby.ToString()]);
				_Lastupdate = dr[Field.Lastupdate.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.Lastupdate.ToString()]);
			}
		}
		public csreportgroupsInfo(csreportgroupsInfo objEntr)
		{			
			_DB = objEntr.DB;			
			_ReportGroup = objEntr.ReportGroup;			
			_Name = objEntr.Name;			
			_DAGid = objEntr.DAGid;			
			_Createdby = objEntr.Createdby;			
			_Insertpointoftime = objEntr.Insertpointoftime;			
			_Updatedby = objEntr.Updatedby;			
			_Lastupdate = objEntr.Lastupdate;			
		}
        #endregion Constructor
        
        #region InitTable
		public DataTable ToDataTable()
		{
			DataTable dt = new DataTable("csreportgroups");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.DB.ToString(), typeof(String)),
				new DataColumn(Field.ReportGroup.ToString(), typeof(String)),
				new DataColumn(Field.Name.ToString(), typeof(String)),
				new DataColumn(Field.DAGid.ToString(), typeof(String)),
				new DataColumn(Field.Createdby.ToString(), typeof(String)),
				new DataColumn(Field.Insertpointoftime.ToString(), typeof(DateTime)),
				new DataColumn(Field.Updatedby.ToString(), typeof(String)),
				new DataColumn(Field.Lastupdate.ToString(), typeof(DateTime))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.DB.ToString()] = _DB;
			row[Field.ReportGroup.ToString()] = _ReportGroup;
			row[Field.Name.ToString()] = _Name;
			row[Field.DAGid.ToString()] = _DAGid;
			row[Field.Createdby.ToString()] = _Createdby;
			row[Field.Insertpointoftime.ToString()] = _Insertpointoftime;
			row[Field.Updatedby.ToString()] = _Updatedby;
			row[Field.Lastupdate.ToString()] = _Lastupdate;
			return row;
		}
        #endregion InitTable
    }
}
